// index.js
// 获取应用实例
const app = getApp()

Page({
	data: {
		show: true,
		addimg: true,
		current: 1,
		hint: "**向左滑表示切换，向右滑表示匹配",
		middle: "向右滑表示匹配",
		suited: "匹配成功后，双方即可交换图书",
		duration: "500",
		imgUrl: ["../../assets/images/index-icon/12@x3.png", "https://xwx.gzzmedu.com:6899/pic/wx-x-mai/ppt/HSBG.png", "https://xwx.gzzmedu.com:6899/pic/wx-x-mai/ppt/GD.png"]
	},
	onLoad() {
		// this.randomBook();
	},
	/**
	 * @获取图书列表
	 */
	randomBook() {
		wx.$API['booksProduct/randomBook']({})
			.then((res) => {
				console.log(res);
			})
			.catch((err) => {
				wx.showToast({
					title: "获取图书失败",
					icon: "none",
					duration: 2000
				})
			})
	},
	// 事件处理函数
	onReady() {
		this.dialog = this.selectComponent("#dialog")
	},
	showDialog() {
		this.dialog.showDialog()
	},
	_confirmEvent() {
		this.dialog.hideDialog()
	},
	showClick() {
		this.setData({
			show: false
		})
	},
	tjClick() {
		this.setData({
			addimg: !this.data.addimg
		})
	},
	issue() {
		wx.navigateTo({
				url: "../chooseBooks/chooseBooks"
			}),
			this.tjClick()
	},
	issueList() {
		wx.navigateTo({
				url: "../releaseList/releaseList"
			}),
			this.tjClick()
	},
	swopList() {
		wx.navigateTo({
				url: "../exchangeList/exchangeList"
			}),
			this.tjClick()
	},
	eventhandle(e) {
		const nowaday = e.detail.current;
		if (nowaday > this.data.current) {
			console.log('++');
		} else if (nowaday < this.data.current) {
			console.log('--');
			wx.navigateTo({
				url: "../choiceQuestion/choiceQuestion"
			})
		}

	}
})